<?php
class CV_Validate_Array extends CV_Validate_Decorator_Abstract{
	protected $_valid = NULL;
	public function _isValid( $value ){
        if (!is_array($value)) {
			$this->_messages[] = "'$value' is not an array";
			return false;
		}
		
		$this->_valid = true;

		foreach ($value as $elem) {
			if ( !empty($this->_options['recursive']) && is_array( $elem ) ){
				$this->_isValid( $elem );
			} else {
				if ( ! $this->_validator->isValid($elem) ) {
					$this->_messages = array_merge( $this->_messages, $this->_validator->getMessages() );
					$this->_valid = false;					
				}
			}
		}

		return $this->_valid;
	}
}